#include<iostream>
#include<array>
using namespace std;

void golf_show(const array<double,10>&arr, int j);

double golf_average(const array<double,10>&arr, int j);

int main()
{
    array<double,10>golf_score;
    cout << "Enter ten golf scores:(enter nonpostive number to stop)";
    double temporary;
    int i = 0;
    while ( cin >> temporary && temporary > 0)
    {
        golf_score[i] = temporary;
        cout << "Enter again:";
        i++;
    }
    int j = i;
    golf_show(golf_score, j);
    cout << "The golf scores average is : " << golf_average(golf_score, j) << endl;

    return 0;
}

void golf_show(const array<double,10>&arr,int j)
{
    cout << "Golf score "<< " : ";
    for ( int i = 0; i < j; i++)
    cout << arr[i] << "\t";
    cout << endl;
}

double golf_average(const array<double,10>&arr,int j)
{
    double total = 0;
    for ( int i = 0; i < j; i++)
    total += arr[i];
    return total / j;
}